package com.cy5;

import java.util.ArrayList;
import java.util.List;

/**
 * 2022年课堂代码
 *
 * @author xxx
 * @date 2022/08/02 09:15
 **/
public class BitInClass {



    int[] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

    public static void main(String[] args) {
        // int[] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
        // sort1(arr);
        // System.out.println(Arrays.toString(arr));
//        System.out.println(selfDividingNumbers(1, 22));

    }

    public void test() {
        selfDividingNumbers(1, 45);
    }

    protected List<Integer> selfDividingNumbers(int left, int right) {
        System.out.println("我执行了父类中的方法！");

        List<Integer> list = new ArrayList<Integer>();
        flag:
        for (int i = left; i <= right; i++) {
            int tmp = i;
            while (tmp != 0) {
                if (tmp % 10 != 0 && (i % (tmp % 10)) == 0) {
                    ;
                } else {
                    continue flag;
                }
                tmp /= 10;
            }
            list.add(i);
        }
        return list;
    }

    private static void sort1(int[] arr) {
        int i = 0;
        int j = arr.length - 1;
        while (i < j) {
            while (i < j && arr[i] % 2 != 0) {
                i++;
            }
            while (i < j && arr[j] % 2 == 0) {
                j--;
            }
            int tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
    }
}
